package com.bdqn.service.impl;

import com.bdqn.mapper.DevUserMapper;
import com.bdqn.pojo.AppInfo;
import com.bdqn.pojo.DevUser;
import com.bdqn.service.DevUserService;
import com.bdqn.util.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DevUserServiceImpl implements DevUserService {
    @Resource
    private DevUserMapper devUserMapper;
    @Override
    public DevUser login(String devCode, String devPassword) {
        if (devCode == null || devPassword == null){
            return null;
        }
        return devUserMapper.login(devCode, devPassword);
    }

    @Override
    public int count(String softwareName, Integer status, Integer flatformId) {
        return devUserMapper.count(softwareName, status, flatformId);
    }

    @Override
    public List<AppInfo> page(String softwareName, Integer status, Integer flatformId, Page page) {
        Integer pageSize =  page.getPageSize();
        Integer pageIndex =  ((page.getCurrentPageNo()-1)*pageSize);
        return devUserMapper.page(softwareName, status, flatformId, pageIndex, pageSize);
    }
}
